import java.util.Scanner;
public class Main {
    //给植物浇水II
    public static int check(int a,int b,int[] nums) {
        int n=nums.length;
        int tempa=a;
        int tempb=b;
        int left=0;
        int right=n-1;
        int count=0;
        while(left<right){
            if(tempb<nums[right]){
                tempb=b;
                count++;
            }
            tempb-=nums[right];
            right--;
            if(tempa<nums[left]){
                tempa=a;
                count++;
            }
            tempa-=nums[left];
            left++;
            if(left==right&&Math.max(tempa,tempb)<nums[right]){
                count++;
            }
        }
        return count;
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] nums=new int[n];
        for(int i=0;i<n;i++){
            nums[i]=sc.nextInt();
        }
        int a=sc.nextInt();
        int b=sc.nextInt();
        int count=check(a,b,nums);
        System.out.println(count);
    }
}